home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
001-010
/
amok08
/
blitter
/
blitter.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
3KB
|
121 lines
MODULE Blitter;
FROM SYSTEM IMPORT ADR, ADDRESS, SHIFT, BITSET, CAST;
FROM Dos IMPORT Delay;
FROM Graphics IMPORT OwnBlitter, DisownBlitter, WaitBlit, ViewModes,
ViewModeSet, RastPortPtr, Draw, Move, DrawModes,
DrawModeSet, SetDrMd;
FROM Hardware IMPORT Custom;
FROM Intuition IMPORT OpenScreen, CloseScreen, customScreen, NewScreen,
ScreenPtr, CurrentTime;
FROM InOut IMPORT WriteInt, WriteString, WriteLn;
VAR
NuScreen: NewScreen;
Screen: ScreenPtr;
custom [0DFF000H]: Custom;
Oktant: ARRAY[0..7] OF CARDINAL;
i: INTEGER;
x0,y0,x1,y1: INTEGER;
Secs,secs,Micros,micros: LONGINT;
(*------ Let Blitter draw a Line: ------*)
(* $V- $R- $S- *)
PROCEDURE BlitLine(x0,y0,x1,y1:INTEGER; Plane: ADDRESS; Width: INTEGER);
VAR
exg: INTEGER;
Okt: CARDINAL;
BEGIN
INC(Plane,Width*y0 + SHIFT(CAST(INTEGER,{4..15} * CAST(BITSET,x0)),-3));
Okt := 0;
DEC(y1,y0);
IF y1<0 THEN
y1 := - y1;
INC(Okt,4);
END;
DEC(x1,x0);
IF x1<0 THEN
x1 := - x1;
INC(Okt,2);
END;
IF x1>y1 THEN
exg := x1; x1 := y1; y1 := exg;
INC(Okt);
END;
Okt := Oktant[Okt];
INC(x1,x1);
WITH custom DO
WHILE 14 IN dmaconr DO END;
dmacon := {15,10,6};
bltbmod := x1;
DEC(x1,y1);
IF x1<0 THEN INC(Okt,64) END;
bltapt := ADDRESS(CAST(CARDINAL,x1));
bltamod := CAST(CARDINAL,x1-y1);
bltadat := 08000H;
bltbdat := 0FFFFH;
bltafwm := 0FFFFH;
bltcon0 := CAST(BITSET,SHIFT(CAST(CARDINAL,CAST(BITSET,x0)*{0..3}),12) + 0B4AH);
bltcon1 := CAST(BITSET,Okt);
bltcpt := Plane;
bltdpt := Plane;
bltcmod := Width;
bltdmod := Width;
bltsize := SHIFT(y1+1,6)+2;
END; (* WITH Custom DO *)
END BlitLine;
(* $V+ $R+ $S+ *)
BEGIN
Oktant[0] := 1;
Oktant[1] := 17;
Oktant[2] := 9;
Oktant[3] := 21;
Oktant[4] := 5;
Oktant[5] := 25;
Oktant[6] := 13;
Oktant[7] := 29;
WITH NuScreen DO
leftEdge := 0; topEdge := 0; width := 320; height := 256; depth := 1;
detailPen := 0; blockPen := 1;
viewModes := ViewModeSet{};
type := customScreen;
font := NIL;
defaultTitle := ADR("Blitter");
gadgets := NIL;
customBitMap := NIL;
END;
Screen := OpenScreen(NuScreen);
OwnBlitter();
WITH Screen^.bitMap DO
CurrentTime(ADR(Secs),ADR(Micros));
FOR i:=0 TO 31 DO
FOR x0:=0 TO 319 DO
BlitLine( 0, 0, x0,255,planes[0],bytesPerRow);
BlitLine( x0,255,319, 0,planes[0],bytesPerRow);
BlitLine( 0,255, x0, 0,planes[0],bytesPerRow);
BlitLine( x0, 0,319,255,planes[0],bytesPerRow);
END;
END;
END;
CurrentTime(ADR(secs),ADR(micros));
DisownBlitter();
IF micros<Micros THEN
INC(micros,1000000);
DEC(secs,1);
END;
WriteString("This took");
WriteInt(secs-Secs,3); WriteString(" seconds and");
WriteInt(micros-Micros,7); WriteString(" micros."); WriteLn;
CloseScreen(Screen);
END Blitter.